package org.microdream.easy.deploy.utils;

import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

public class ListUtil {

    public static List removeDuplicate(List list) {
        HashSet h = new HashSet(list);
        list.clear();
        list.addAll(h);
        return list;
    }

    public static String ListToString(List list,String delimiter){
        return String.join(delimiter,ObjectToString(list));
    }

    public  static List<String> ObjectToString(List<Object> list){
        return list.stream().map(o -> String.valueOf(o)).collect(Collectors.toList());
    }

    public static List<Integer> StringToInteger(List<String> list){
        return list.stream().map(s -> Integer.parseInt(s)).collect(Collectors.toList());
    }
}
